//
//  BuyTableViewCell.m
//  UI_HLJ_Frame
//
//  Created by dllo on 15/7/8.
//  Copyright (c) 2015年 毕宏伟. All rights reserved.
//

#import "BuyTableViewCell.h"

@implementation BuyTableViewCell

- (void)dealloc
{
    [_purchase_notes retain];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.purchase_notes = [[UILabel alloc] init];
        [self.contentView addSubview:self.purchase_notes];
    }
    return self;
    
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    //    self.details.frame = CGRectMake(10, 10, 355, 500);
//    self.purchase_notes.backgroundColor = [UIColor colorWithRed:1.000 green:0.648 blue:0.202 alpha:1.000];
    self.purchase_notes.numberOfLines = 0;
    self.purchase_notes.lineBreakMode = 1;
    NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:14],NSFontAttributeName, nil];
    // 根据文本计算高度,限制一个文本的最大范围(375,0)
    // 第二个属性作用:指定一个属性来定义对应文本和字体所占用的高度
    CGRect rect = [self.purchase_notes.text boundingRectWithSize:CGSizeMake(self.contentView.frame.size.width-20, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    self.purchase_notes.frame = CGRectMake(10,0, self.contentView.frame.size.width-20, rect.size.height + 50);
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
